<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>个人音乐</title>
    <link rel="icon" href="${pageContext.request.contextPath}/img/icon.ico">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/personalMusic.css">
    <c:set var="downURL" value="${pageContext.request.contextPath}/download?musicName="/>
    <c:set var="infoURL" value="${pageContext.request.contextPath}/toPlayMusic?musicName="/>
    <c:set var="loginName" value="${sessionScope.loginName}"/>
    <c:if test="${loginName==null || loginName.equals('')}">
        <c:redirect url="toLogin"/>
    </c:if>
    <script src="${pageContext.request.contextPath}/js/jquery-1.10.2.min.js"></script>
    <script>
        window.onload=function () {
            $.ajax({
                type:"POST",
                url:"${pageContext.request.contextPath}"+"/getAllMusic"
            })
        }
    </script>


</head>
<body>
<div id="leftSide">
    <ul>
        <li class="fnt1"><a href="${pageContext.request.contextPath}/index">M</a></li>
        <li><a href="${pageContext.request.contextPath}/index"><img src="${pageContext.request.contextPath}/img/house1.png" alt=""><span>Home</span></a></li>
        <li><a href="${pageContext.request.contextPath}/personalMusic"><img src="${pageContext.request.contextPath}/img/music.png" alt=""><span>音乐馆</span></a></li>
        <li><a href="${pageContext.request.contextPath}/userLogin"><img src="${pageContext.request.contextPath}/img/login.png" alt=""><span>登陆</span></a></li>
        <li><a href="${pageContext.request.contextPath}/userRegister"><img src="${pageContext.request.contextPath}/img/register.png" alt=""><span>注册</span></a></li>
        <li><a href="${pageContext.request.contextPath}/adminLogin"><img src="${pageContext.request.contextPath}/img/admin.png" alt=""><span>管理员</span></a></li>
    </ul>
</div>
<div id="box">
    <div class="header">
        <section class="header_1">
            <img src="${pageContext.request.contextPath}/img/musicLogo.png" alt="">
        </section>
        <section class="header_2">
            <ul id="nav">
                <li><a href="#">音乐馆</a></li>
                <li><a href="#">我的音乐</a></li>
            </ul>
        </section>
        <section class="header_3">
            <input type="text" placeholder="我们不一样">
            <i class="icon_search"></i>
        </section>
        <section class="header_4">
            <span>${sessionScope.loginName}</span>的音乐
        </section>
    </div>
    <div class="middle">
        <section class="handle">
            <div class="form-group">
                <input type="button" class="btn btn-success" value="播放全部">
                <input type="button" class="btn btn-warning" value="添加到">
                <input type="button" class="btn btn-info" value="下载">
                <input type="button" class="btn btn-danger" value="批量操作">
            </div>
        </section>
        <section class="musicInfo">
            <table style="width: 1400px">
                <tr>
                    <td>歌名</td>
                    <td>歌手</td>
                    <td>专辑</td>
                    <td>下载</td>
                </tr>
                <c:forEach items="${sessionScope.musicList}" var="musicInfo">
                    <tr>
                        <td>
                            <%--<%=infoURL + musicInfo.getMusicName()+"&musicPath="+m.getMusicPath()+"&musicPic="+m.getMusicPic()+"&musicInfo="+m.getMusicInfo()+"&singer="+m.getSinger()%>--%>
                            <a class="td_a" target="_blank" href="${infoURL}${musicInfo.musicName}&musicPath=${musicInfo.musicPath}&musicPic=${musicInfo.musicPic}&musicInfo=${musicInfo.musicInfo}&singer=${musicInfo.singer}">
                                ${musicInfo.musicName}
                            </a>
                        </td>
                        <td>${musicInfo.singer}</td>
                        <td> ${musicInfo.musicInfo}</td>
                        <td>
                            <%--<a href="<%=downURL + m.getMusicPath().split("/")[2]%>">下载歌曲</a>--%>
                            <a href="${downURL}${musicInfo.musicPath.split("/")[1]}">下载歌曲</a>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </section>
        <section class="pages">
            <span>占位区，分页栏</span>
        </section>
    </div>
</div>
</body>
</html>
